<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>父向子通信</title>
</head>
<body>
    <div id="app">
       <h2>李雨航：{{ age }}</h2>
       <hr>
       <Child :age="age"></Child>
       <Child></Child>
       <hr>
       <button @click="aaa">自增</button>
    </div>
    <script id="child" type="text/x-template">
      <h2>{{age}}</h2>
    </script>
    <script src="./js/vue.js"></script>
    <script>
            const Child = {
                template:'#child',
                props:{
                    age:{
                        type:Number,
                        default:100
                    }
                }
            }


        const app = new Vue({
            el:'#app',
            data:{
                age:12
            },
            components:{Child},
            methods:{
                aaa(){
                    this.age ++
                }
            }
        })
    </script>
</body>
</html>